import 'package:flutter/material.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';
import 'package:get/get.dart';
import 'package:kq_flutter_widgets/resources/kq_theme_colors.dart';
import 'package:kq_flutter_widgets/widgets/button/kq_outline_button.dart';
import 'package:kq_flutter_widgets/widgets/card/kq_card.dart';
import 'package:kq_flutter_widgets/widgets/card/kq_select_card.dart';
import 'package:kq_flutter_widgets/widgets/card/kq_simple_card.dart';
import 'package:kq_flutter_core_widget/widgets/image/kq_image.dart';
import 'package:kq_flutter_widgets/widgets/image/kq_print_image.dart';
import 'package:kq_flutter_widgets/widgets/tagView/kq_tag_view.dart';
import 'package:kq_flutter_widgets/widgets/titleBar/kq_title_bar.dart';
import 'package:kq_flutter_widgets_example/resources/kq_images.dart';

class KqCardPage extends StatefulWidget {
  const KqCardPage({super.key});

  @override
  State<KqCardPage> createState() => _KqCardPageState();
}

class _KqCardPageState extends State<KqCardPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: KqHeadBar(
        headTitle: '卡片',
        back: () => Get.back,
      ),
      body: ListView.builder(
        itemCount: 4,
        itemBuilder: (context, index) {
          if (index == 0) {
            return KqCard(
              title: 'KqCard某某设备',
              subTitleImg: KqImages.remakeIcRenyuan12Black,
              subTitle: '232o3u2编号',
              imgType: ImageType.oss,
              isChinese: true,
              defaultPic: KqImages.dateBackIcSamaqiang,
              dividePosition: DividePosition.top,
              totalCount: 4,
              renderCrossAxisCountCallback: (row) {
                return 2;
              },
              renderIconPathCallback: (row, column) {
                return KqImages.remakeIcJieguo12Black;
              },
              renderTextCallback: (row, column) {
                if (row == 0) {
                  return 'kjakljfkadfjlkajdflkajasss';
                }
                return '辣椒的饭卡就打发了大家福利卡的肌肤';
              },
              rowCountCallback: () => 2,
              renderTextMaxLineCallback: (row, column) => 1,
            );
          } else if (index == 1) {
            return KqCard(
              title:
                  'KqCard某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设',
              subTitleImg: KqImages.remakeIcRenyuan12Black,
              subTitle:
                  '232o3u2编号232o3u2编号232o3u2编号232o3u2编号232o3u2编号232o3u2编号',
              isChinese: true,
              subSecondTitleImg: KqImages.remakeIcRenyuan12Black,
              subSecondTitle: '232o322222223u2编号',
              imgType: ImageType.oss,
              defaultPic: KqImages.dateBackIcSamaqiang,
              dividePosition: DividePosition.top,
              totalCount: 4,
              printType: KqPrintType.qualified,
              renderCrossAxisCountCallback: (row) {
                return 2;
              },
              renderIconPathCallback: (row, column) {
                return KqImages.remakeIcJieguo12Black;
              },
              renderTextCallback: (row, column) {
                if (row == 0) {
                  return 'kjakljfkadfjlkajdflkajasss';
                }
                return '辣椒的饭卡就打发了大家福利卡的肌肤';
              },
              rowCountCallback: () => 2,
              renderTextMaxLineCallback: (row, column) => 1,
            );
          } else if (index == 2) {
            return KqCard(
              title: 'KqCard某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设备',
              subTitleImg: KqImages.remakeIcRenyuan12Black,
              subTitle: '232o3u2编号',
              imgType: ImageType.oss,
              isChinese: true,
              defaultPic: KqImages.dateBackIcSamaqiang,
              dividePosition: DividePosition.bottom,
              printType: KqPrintType.qualified,
              bottomBtnsView: Container(
                padding: EdgeInsets.symmetric(vertical: 8.r),
                margin: EdgeInsets.only(right: 16.r),
                height: 56.r,
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  crossAxisAlignment: CrossAxisAlignment.center,
                  children: const [
                    KqOutlineButton(title: '开始维修'),
                    SizedBox(
                      width: 12,
                    ),
                    KqOutlineButton(title: '维修结论')
                  ],
                ),
              ),
              tags: const [
                KqTagView(text: '紧急', backgroundColor: KqThemeColors.textRed),
                KqTagView(
                  text: '常规',
                  backgroundColor: KqThemeColors.bgBlack50,
                )
              ],
              totalCount: 5,
              renderCrossAxisCountCallback: (row) {
                if (row == 2) {
                  return 1;
                }
                return 2;
              },
              renderIconPathCallback: (row, column) {
                return KqImages.remakeIcJieguo12Black;
              },
              renderTextCallback: (row, column) {
                if (row == 0) {
                  return 'kjakljfkadfjlkajdflkajasss';
                }
                return '辣椒的饭卡就打发了大家福利卡的肌肤家福利卡的肌肤家福利卡的肌肤';
              },
              rowCountCallback: () => 3,
              renderTextMaxLineCallback: (row, column) => 1,
            );
          } else if (index == 3) {
            return KqSelectCard(
              isSelect: false,
              imgType: ImageType.oss,
              defaultPic: KqImages.dateBackIcSamaqiang,
              totalCount: 4,
              title: 'KqSelectCard选择卡片',
              subTitle: '选择卡片副标题',
              isChinese: true,
              dividePosition: SelectDividePosition.bottom,
              renderCrossAxisCountCallback: (row) => 2,
              rowCountCallback: () => 2,
              renderTextMaxLineCallback: (row, column) => 1,
              renderIconPathCallback: (row, column) {
                return KqImages.remakeIcJieguo12Black;
              },
              renderTextCallback: (row, column) {
                if (row == 0) {
                  return 'kjakljfkadfjlkajdflkajasss';
                }
                return '辣椒的饭卡就打发了大家福利卡的肌肤家福利卡的肌肤家福利卡的肌肤';
              },
            );
          } else {
            return KqSimpleCard(
              title:
                  'KqSimpleCard某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设某某设备某某设备某某设备某某设备某某设备某某设备某某设备某某设',
              dividePosition: SimpleDividePosition.top,
              totalCount: 4,
              isChinese: true,
              printType: KqPrintType.qualified,
              renderCrossAxisCountCallback: (row) {
                return 2;
              },
              renderIconPathCallback: (row, column) {
                return KqImages.remakeIcJieguo12Black;
              },
              renderTextCallback: (row, column) {
                if (row == 0) {
                  return 'kjakljfkadfjlkajdflkajasss';
                }
                return '辣椒的饭卡就打发了大家福利卡的肌肤';
              },
              rowCountCallback: () => 2,
              renderTextMaxLineCallback: (row, column) => 1,
            );
          }
        },
      ),
    );
  }
}
